/**
 * @description 表头
 * @firstColumns 支入积分明细
 * @secondColumns 转换会员列表
 */
export const firstColumns = [
  { prop: 'id', label: 'ID' },
  {
    label: '客户信息',
    render: (h, { row }) => {
      return (
        <div>
          <p>{row.userName}</p>
          <p>{row.userMobile}</p>
          {!row.isNew ? (
            <p style={'padding:2px 6px;background-color: red;border-radius: 3px;color:#fff'}>
              新用户
            </p>
          ) : (
            ''
          )}
        </div>
      )
    }
  },
  { prop: 'amount', label: '转换积分值' },
  { prop: 'exchangeRateStr', label: '转换汇率' },
  {
    label: '积分类型',
    render: (h, { row }) => {
      return (
        <div>
          <p>{row.transactionType == 0 ? '收入' : '支出'}</p>
        </div>
      )
    }
  },
  { prop: 'availableBalance', label: '账户积分' },
  { prop: 'description', label: '积分兑换描述' },
  { prop: 'createdTime', label: '操作时间' },
  { prop: 'ip', label: 'IP地址' },
  {
    label: '状态',
    render: (h, { row }) => {
      return (
        <div>
          <p style={row.recordStatus ? 'color: #333' : 'color: red'}>
            {row.recordStatus ? '成功' : '失败'}
          </p>
        </div>
      )
    }
  }
]

export const handlePlatFrom = value => {
  // 2: 好物特工, 4: 酒馆长, 8: 挖咖, 16: 机咖, 32: 秦宗, 64: 机甲通
  const obj = {
    2: '好物特工',
    4: '酒馆长',
    8: '挖咖',
    16: '机咖',
    32: '秦宗',
    64: '机甲通'
  }

  return obj[value]
}

export const secondColumns = [
  {
    label: '客户信息',
    render: (h, { row }) => {
      return (
        <div>
          <p>{row.nickName}</p>
          <p>{row.mobile}</p>
          {!row.isNew ? (
            <p
              style={
                'width:50px;height:30px ; margin: 0 auto;background-color: red;border-radius: 3px;color:#fff'
              }
            >
              新用户
            </p>
          ) : (
            ''
          )}
        </div>
      )
    }
  },
  {
    label: '客户来源',
    render: (h, { row }) => {
      return (
        <div>
          <p>{handlePlatFrom(row.registerWay)}</p>
        </div>
      )
    }
  },
  {
    label: '注册方式',
    render: (h, { row }) => {
      return (
        <div>
          <p>第三方平台</p>
        </div>
      )
    }
  },
  { prop: 'createdTime', label: '注册时间' }
]
